/*
Package models
@Author   : Uyynot
@Email    : uyynot@qq.com
@Time     : 2024/3/25 13:35
@File     : model.go
@Project  : gohub
@Desc     :
*/
package models

import (
	"github.com/spf13/cast"
	"time"
)

// BaseModel 模型基类
type BaseModel struct {
	ID uint64 `json:"id,omitempty" gorm:"column:id;primaryKey;autoIncrement;"`
}

// CommonTimestampsField 时间戳
type CommonTimestampsField struct {
	CreatedAt time.Time `json:"created_at,omitempty" gorm:"column:created_at;index"`
	UpdatedAt time.Time `json:"updated_at,omitempty" gorm:"column:updated_at;index"`
}

// GetStringID 获取ID的字符串形式
func (a BaseModel) GetStringID() string {
	return cast.ToString(a.ID)
}
